/*
	析构函数可以是虚函数，构造函数不能是虚函数；

	虚析构函数：
		子类指针指向派生类调用析构函数时, 与派生类本身调用析构函数无差
*/
#include <iostream>
using namespace std;

class base {
	public:
		base() { cout << "base()" << endl; }
		virtual ~base() { cout << "virtual ~base()" << endl; }
};

class derived : public base {
	public:
		derived() { cout << "derived()" << endl; }
		virtual ~derived() { cout << " virtual ~derived()" << endl; }
};

int main(int argc, char * argv[]) {
	base * pb = new derived;

	delete pb;

	return 0;
}
